package com.one.consumer.reserve.ui.activity;

import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.one.common.config.RouterPath;
import com.one.common.manager.RouterManager;
import com.one.common.model.extra.DefaultExtra;
import com.one.common.view.widget.MyTitleBar;
import com.one.consumer.BaseActivityC;
import com.one.consumer.R;
import com.one.common.common.order.extra.ReserveExtra;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * author ：zhulunjun
 * email  ：zhulunjun@qq.com
 * date   ：2018/10/22 下午11:06
 * description ：预约成功页面
 **/
@Route(path = RouterPath.RESERVE_SUCCESS)
public class ReserveSuccessActivity extends BaseActivityC {
    @BindView(R.id.tv_message)
    TextView tvMessage;
    @BindView(R.id.tv_message_1)
    TextView tvMessage1;
    @BindView(R.id.tv_submit)
    TextView tvSubmit;
    private ReserveExtra mExtra;

    @Override
    protected void initPresenter() {

    }

    @Override
    public int getLayoutResId() {
        return R.layout.activity_reserve_success;
    }

    private String title;

    @Override
    protected void initTitle() {
        super.initTitle();
        mExtra = (ReserveExtra) getIntent().getSerializableExtra(ReserveExtra.getExtraName());

        if (mExtra.getType().equals(ReserveExtra.STYLE_DE)) {
            title = "装修预约";
        } else if (mExtra.getType().equals(ReserveExtra.STYLE_DY)) {
            title = "设计预约";
        } else if (mExtra.getType().equals(ReserveExtra.STYLE_SR)) {
            title = "一键保修";
        } else {
            title = "定制加配";
        }
        getMyTitleBar().setMode(MyTitleBar.Mode.BACK_TITLE)
                .setTitleText(title);
    }

    @Override
    public void initView() {
        super.initView();
        if (mExtra.getType().equals(ReserveExtra.STYLE_DE)) {
            tvMessage.setText("装修预约成功");
            tvMessage1.setText("稍后会有师傅联系，请保持手机畅通！");
        } else if (mExtra.getType().equals(ReserveExtra.STYLE_DY)) {
            tvMessage.setText("设计预约成功");
            tvMessage1.setText("稍后会有客服联系，请保持手机畅通！");
        } else if (mExtra.getType().equals(ReserveExtra.STYLE_SR)) {
            tvMessage.setText("报修已提交");
            tvMessage1.setText("稍后会有师傅电联，请保持手机畅通！");
        } else {
            tvMessage.setText("定制加配预约成功");
            tvMessage1.setText("稍后会有客服联系，请保持手机畅通！");
        }
    }

    @OnClick(R.id.tv_submit)
    public void submit() {
        // 去预约中心
        if (mExtra.getType().equals(ReserveExtra.STYLE_SR)) {
            RouterManager.getInstance().goAndFinish(this, RouterPath.MAIN_PAGE,new DefaultExtra(1));
        } else {
            // 保修去我的订单列表
            RouterManager.getInstance().goAndFinish(this, RouterPath.RESERVE_CENTER);
        }
    }


}
